package com.dayatang.hrm.compensation.domain;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.MappedSuperclass;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import com.dayatang.commons.domain.AbstractEntity;
import com.dayatang.commons.domain.Value;

/**
 * 薪资参数记录抽象
 * 
 * @author chencao
 * 
 */
@MappedSuperclass
public abstract class SalaryParameterRecord extends AbstractEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7240683224117799544L;

	// 参数值
	// @Index(name="PARAMETER_VALUE_ID_FK_IDX")
	@Embedded
	private Value parameterValue;

	// // 数据取值范围
	// private DataRange dataRange;

	// 设置起始点
	@Column(name = "from_date")
	private Date from;

	// 设置结束点
	@Column(name = "to_date")
	private Date to;

	public Value getParameterValue() {
		return parameterValue;
	}

	public void setParameterValue(Value parameterValue) {
		this.parameterValue = parameterValue;
	}

	public Date getFrom() {
		return from;
	}

	public void setFrom(Date from) {
		this.from = from;
	}

	public Date getTo() {
		return to;
	}

	public void setTo(Date to) {
		this.to = to;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof SalaryParameterRecord == false) {
			return false;
		}
		if (this == obj) {
			return true;
		}
		SalaryParameterRecord rhs = (SalaryParameterRecord) obj;
		return new EqualsBuilder().append(getId(), rhs.getId()).isEquals();
	}

	@Override
	public int hashCode() {
		return new HashCodeBuilder(17, 37).append(getId()).toHashCode();
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this,
				ToStringStyle.SHORT_PREFIX_STYLE);
	}

}
